#include<pthread.h>
#include<stdio.h>
#include<stdlib.h>

void * printHello(void * arg){

    int * intptr = (int*)arg;
    printf("Hello World! arg=%d.\n",*intptr);

    return NULL;
}

int main(int argc,char * argv[]){

    // int * intptr = (int *)arg;
    pthread_t secondThread;
    int rtv = 0;    // 作为pthread_create的返回值
    int arg = 123456;
    rtv = pthread_create(&secondThread,NULL,printHello,(void*)&arg);

    if(0!=rtv){

        printf("ERROR; pthread_create() returns %d.\n",rtv);
        return EXIT_FAILURE;
    }
    rtv = pthread_join(secondThread,NULL);
    if(0 != rtv){

        printf("ERROR; pthread_create_join() returns %d.\n",rtv);
        return EXIT_FAILURE;
    }
    return EXIT_SUCCESS;
}